package state;

public class Eval {
	
	public static final long[] kingsideMask = { 67569408L, 1978038598238208L}; // white, black
	
	public static final long[] whiteKSpawnShields = { 1792L, 132352L, 67072L, 262912L,  67109632L  };	 //best, fianchetto, best w/h3, best w/f3, best w/f4
	public static final long[] blackKSpawnShields = { 1970324836974592L, 1409573906808832L, 1689949371891712L,
		848822976643072L,  844442110001152L  };	 //best, fianchetto, best w/h3, best w/f3, best w/f4
	
	public static boolean goodKingsideShield(long x, int color) {
		
		if (color==0) {
			for (int i=0; i < whiteKSpawnShields.length; i++ )
				if (x == whiteKSpawnShields[i]) return true;
		}
		else {
			for (int i=0; i < blackKSpawnShields.length; i++ )
				if (x == blackKSpawnShields[i]) return true;
		}
		return false;
	}
	
	static final short[]  queenTable = new short[] {
		//queen
		-20,-10,-10, -5, -5,-10,-10,-20,
		-10,  0,  0,  0,  0,  0,  0,-10,
		-10,  0,  5,  5,  5,  5,  0,-10,
		 -5,  0,  5,  5,  5,  5,  0, -5,
		 -5,  0,  5,  5,  5,  5,  0, -5,
		-10,  5,  5,  5,  5,  5,  0,-10,
		-10,  0,  5,  0,  0,  0,  0,-10,
		-20,-10,-10, -5, -5,-10,-10,-20
	};
	static short[] blackQueenTable= new short[64];
	static 
	{
		for (int i = 0; i < 64; i++) 
			blackQueenTable[i] = queenTable[63-i];
	}
	
	static final short[] whitePawnTable = new short[]
			{
				0,  0,  0,  0,  0,  0,  0,  0,
				25, 25, 25, 25, 25, 25, 25, 25,
				22, 22, 22, 22, 22, 22, 22, 22,
				5,  5, 10, 20, 20, 10,  5,  5,
				0,  0,  0, 20, 20,  0,  0,  0,
				5, -5,- 5,  0,  0, -5, -5,  5,
				5, 10, 10,-25,-25, 10, 10,  5,
				0,  0,  0,  0,  0,  0,  0,  0
			};
	
	static short[] blackPawnTable= new short[64];
	static 
	{
		for (int i = 0; i < 64; i++) 
			blackPawnTable[i] = whitePawnTable[63-i];
	}	
	
	 
	//Knights are encouraged to control the center and stay away from edges to increase mobility:

	static final short[] knightTable = new short[]
			{
		-50,-40,-30,-30,-30,-30,-40,-50,
		-40,-20,  0,  5,  5,  0,-20,-40,
		-30,  5, 10,  5,  5, 10,  5,-30,
		-30,  5, 15, 20, 20, 15,  5,-30,
		-30,  5, 15, 20, 20, 15,  5,-30,
		-30,  5, 10,  5,  5, 10,  5,-30,
		-40,-20,  0,  5,  5,  0,-20,-40,
		-50,-40,-30,-30,-30,-30,-40,-50,
			};
	private static short[] blackKnightTable= new short[64];
	static 
	{
		for (int i = 0; i < 64; i++) 
			blackKnightTable[i] = knightTable[63-i];
	}	
	//Bishops are also encouraged to control the center and stay away from edges and corners:
		
	 static short[][] knighttables = { knightTable, blackKnightTable};
	 
	 
	public static final short[] whiteBishopTable = new short[]
			{
		-20,-10,-10,-10,-10,-10,-10,-20,
		-10,  0,  0,  0,  0,  0,  0,-10,
		-10,  0,  5, 10, 10,  5,  0,-10,
		-10, -5,  5, 10, 10,  5, -5,-10,
		-10,  0, 10, 10, 10, 10,  0,-10,
		-10, 10, 10, 10, 10, 10, 10,-10,
		-10, 10,  0,  0,  0,  0, 10,-10,
		-20,-10,-20,-10,-10,-20,-10,-20,
			};
	private static short[] blackBishopTable= new short[64];
	static 
	{
		for (int i = 0; i < 64; i++) 
			blackBishopTable[i] = whiteBishopTable[63-i];
	}
	 static short[][] bishoptables = { whiteBishopTable, blackBishopTable};
	
	
	 
	static final short[] kingTableEndGame = new short[]
	{
		-50,-40,-30,-20,-20,-30,-40,-50,
		-20,-20,-10,  0,  0,-10,-20,-20,
		-20,-10, 20, 30, 30, 20,-10,-20,
		-20,-10, 30, 40, 40, 30,-10,-20,
		-20,-10, 30, 40, 40, 30,-10,-20,
		-20,-10, 20, 30, 30, 20,-10,-20,
		-20,-20, -10, 0,  0,-10,-20,-20,
		-50,-40,-30,-20,-20,-30,-40,-50
	};
	
	
	static short[][]pieceTables = {  whitePawnTable, blackPawnTable, knightTable, blackKnightTable, 
		whiteBishopTable, blackBishopTable};
	
	static short[][]queenPieceTables = {  queenTable, blackQueenTable };

	
}
